Stacking standard output of `su`

Posted by Kristopher Ives on Stack Overflow See other posts from Stack Overflow or by Kristopher Ives
Published on 2010-05-12T16:31:55Z Indexed on 2010/05/12 16:34 UTC
Read the original article Hit count: 192

Filed under:
|
|

I've got some code that I wrote that uses a combination of bash and PHP command line scripting. The script is ran as root and then uses su to become various uses. I start a session like this:

$result = `su SomeUser ./dothis.php`

Here ./dothis.php is a script that may generate some output being stored in $result, but the problem is that there is usually output that doesn't get caught and makes it hard for me to read my script output.

How can I make sure that the output is being captured within this su stacking?

© Stack Overflow or respective owner

Related posts about php

Related posts about bash